home *** CD-ROM | disk | FTP | other *** search
- static char mk_datestr_prog[] = "@(#)Datums-String aus Tagen,Monaten und Jahren zusammenbauen";
- static char mk_datestr_ver[] = "@(#)v1.00/kr ; 13.04.91";
- /* Autor Klaus Rath
- **
- ** Deklaration char *mk_datestr(int tage,int monate, int jahre, int format);
- **
- */
-
- #include <stdio.h>
- #include <string.h>
- #ifdef __TURBOC__
- #include <stdlib.h>
- #endif
- #include "datum.h"
-
- char *mk_datestr(int tage, int monate, int jahre, int format)
- {
- char datum[11];
- char ts[3];
- char ms[3];
- char js[5];
- char kurzj[3];
-
- sprintf(ts,"%02d",tage);
- sprintf(ms,"%02d",monate);
- sprintf(js,"%04d",jahre);
- kurzj[0] = js[2];
- kurzj[1] = js[3];
- kurzj[2] = '\0';
-
- switch ( format ) {
- case 1 :
- strcpy(datum,ts);
- strcat(datum,".");
- strcat(datum,ms);
- strcat(datum,".");
- strcat(datum,kurzj);
- break;
- case 2 :
- strcpy(datum,ts);
- strcat(datum,".");
- strcat(datum,ms);
- strcat(datum,".");
- strcat(datum,js);
- break;
- case 3 :
- strcpy(datum,ms);
- strcat(datum,"/");
- strcat(datum,ts);
- strcat(datum,"/");
- strcat(datum,kurzj);
- break;
- case 4 :
- strcpy(datum,ms);
- strcat(datum,"/");
- strcat(datum,ts);
- strcat(datum,"/");
- strcat(datum,js);
- break;
- case 5 :
- strcpy(datum,kurzj);
- strcat(datum,ms);
- strcat(datum,ts);
- break;
- case 6 :
- strcpy(datum,js);
- strcat(datum,ms);
- strcat(datum,ts);
- break;
- default: return((char *)NULL);
- } /* ENDE: switch(format) */
-
- return(datum);
- } /* ENDE: mk_datestr() */
-